Nginx Nginx[warn]:an Upstream Response Is Buffered to a Temporary

1.nginx 报错

1
[warn] 19#19: *23 an upstream response is buffered to a temporary file /var/

2.解决

在nginx.conf 的http 里加入如下一段得到解决

1
2
3
4
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

另,如果nginx以proxy模式运行,则需更改上面一段为如下内容:

1
2
3
4
proxy_buffer_size 128k;
proxy_buffers 8 128k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;

注意:很多网上教程 fastcgi_buffers 8 128k;忘记加k ,这个会造成 [emerg] 1#1: “fastcgi_busy_buffers_size” must be less than the size of all “fastcgi_buffers”

完整nginx.conf配置如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# nginx.conf 例:
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

fastcgi_buffer_size 128k;
fastcgi_buffers 8 128;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

include /etc/nginx/conf.d/*.conf;
}

继开 wechat
欢迎加我的微信,共同交流技术